@extends('admin._layouts.default')

@section('main')


      <div class="row-fluid ">
        <div class="span12 box gradient ">
      <div class="title">
            <div class="row-fluid">
                <h3><a href="{{ route('admin.codes.create') }}"  class="btn btn-info btn-mini pull-right mg5"><i class="fa fa-cog"></i> 批量生成</a>
                  <i class="fa fa-shopping-cart"></i> 机器二维码列表
                </h3>
            </div>
        </div><!-- End .title -->
        <div class="content min_h500">

            <table id="datatable_in" class="responsive table table-striped" style="width:100%;margin-bottom:0; ">
              <thead>
               <tr>
                 <th width="80">
                   缩略图
                  </th>
                  <th width="160">
                    型号
                  </th>
                  <th width="120">
                    出厂日期
                  </th>
                  <th>
                    编号
                  </th>
                 <th width="160">
                   保修期
                 </th>
                 <th width="160">
                   操作
                 </th>
               </tr>
              </thead>
              <tbody>
              @foreach($codes as $code)
               <tr>
                  <td>
                   <img class="thumbnail small" src="{{ $PATH }}{{ $code->machine->cover }}">
                  </td>
                 <td>
                    {{ $code->machine->name }}
                  </td>
                  <td>
                    <i class="fa fa-calendar"></i> <?php echo date('Y-m-d',$code->time) ?>
                 </td>
                 <td>
                    {{ $code->start }} - {{ $code->stop }}
                    共{{ $code->stop - $code->start+1 }}个
                 </td>
                 <td>
                    {{ $code->month }}个月
                 </td>
                 <td>
                    <div class="btn-group1">
                      <a class="btn btn-small" rel="tooltip" data-placement="left" data-original-title="下载二维码" href="{{ URL::route('admin.codes.show', $code->id) }}"><i class="gicon-download"></i></a>
                     <a class="btn btn-inverse btn-small" rel="tooltip" data-placement="left" data-original-title="释放二维码" data-toggle="modal" data-target="#confirm_alert"><i class="gicon-remove icon-white"></i></a>
                   </div>
                 </td>
               </tr>
               @endforeach

               </tbody>
            </table>
                <div class="row-fluid control-group">

                    <div class="pagination pull-right ">
                      {{ $codes->link() }}
                    </div>
                </div>
                <br/>


            </div>
        </div>
        <!-- End box -->
      </div>

@stop


@section('modals')
<div id="qrcode_city" class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
      <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 class="modal-title" id="myModalLabel">城市二维码</h3>
      </div>
      <div class="modal-body">
        <div class="row-fluid">
          <div class="span6"><img src="img/qrcode_staff.jpg" /></div>
          <div class="span5"><p>您现在看到的是杭州的二维码</p><p>右键点击图片-图片另存为<br />用于印刷相关城市宣传资料</p></div>
        </div>

      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
      </div>
    </div>
  </div>
</div>

<div id="confirm_alert" class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
      <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 class="modal-title" id="myModalLabel">确定本次操作吗？</h3>
      </div>
      <div class="modal-body">
        <i class=" icon-warning-sign color_red pull-left fs_24"></i>

        <p>一旦【确定】，本次操作不可撤销。</p>

      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
        <button type="button" class="btn btn-primary">确定</button>
      </div>
    </div>
  </div>
</div>
@stop


@section('script')
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/full-calendar/fullcalendar.min.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/jquery.peity.min.js') }}"></script>
<script type="text/javascript" language="javascript" src="{{ URL::asset('ad/js/plugins/datatables/js/jquery.dataTables.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/chosen/chosen/chosen.jquery.min.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/flot/jquery.flot.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/jquery.uniform.min.js') }}"></script>
<script src="{{ URL::asset('ad/js/plugins/justGage.1.0.1/resources/js/raphael.2.1.0.min.js') }}"></script>
<script src="{{ URL::asset('ad/js/plugins/justGage.1.0.1/resources/js/justgage.1.0.1.min.js') }}"></script>
<script src="{{ URL::asset('ad/js/scripts.js') }}"></script>


    <script type="text/javascript" charset="utf-8">
    // Datatables
    $(document).ready(function() {
      var dontSort = [];
                $('#datatable_city thead th').each( function () {
                    if ( $(this).hasClass( 'no_sort' )) {
                        dontSort.push( { "bSortable": false } );
                    } else {
                        dontSort.push( null );
                    }
      } );
      $('#datatable_city').dataTable( {
        "sDom": "<'row table_top_bar'<'row-fluid'>'<'to_hide_phone'>'f'<'>r>t<'row'>",
         "sDom": "<'row table_top_bar'<'row-fluid'<'to_hide_phone' f>>><'row'>",
         "aaSorting": [[ 1, "asc" ]],
        "bPaginate": false,
        "bJQueryUI": false,
        "aoColumns": dontSort

      } );
      $.extend( $.fn.dataTableExt.oStdClasses, {
        "s`": "dataTables_wrapper form-inline"
      } );
    } );
    </script>
@stop
